package itheima_03;

import java.util.Arrays;

public class IntegerText {
    public static void main(String[] args) {
        String s = "91 27 46 38 50";
        String[] strArray = s.split(" ");
        int[] arr = new int[strArray.length];
        for (int i = 0; i < strArray.length; i++) {
            arr[i] = Integer.parseInt(strArray[i]);
        }
        Arrays.sort(arr);//数组静态方法，对数组排序，int型默认从小到大！
        StringBuilder st = new StringBuilder();
        for (int i = 0; i < arr.length; i++) {//将int数组转换成StringBuilder
            if (i == arr.length - 1) {
                st.append(arr[i]);//StringBuilder静态方法，添加元素
            } else {
                st.append(arr[i]).append(" ");
            }
        }
        String result = st.toString();//将StringB转换成String
        System.out.println(result);
    }
}
